package com.suyafei.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * @program: suyafei-1024-shop
 * @description 购物项
 * @author: luffy
 * @create: 2021-03-10 10:12
 */
public class CartItemVO {
    /**
     * 商品Id
     */
    @JsonProperty("product_id")
    private Long productId;
    /**
     * 购买数量
     */
    @JsonProperty("buy_num")
    private Integer buyNum;
    /**
     * 商品名称（冗余）
     */
    @JsonProperty("product_title")
    private String productTitle;
    /**
     * 商品图片
     */
    @JsonProperty("product_img")
    private String productImg;
    /**
     * 单价
     */
    private BigDecimal amount;

    @JsonProperty("product_amount")
    private BigDecimal totalAmount;


    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Integer getBuyNum() {
        return buyNum;
    }

    public void setBuyNum(Integer buyNum) {
        this.buyNum = buyNum;
    }

    public String getProductTitle() {
        return productTitle;
    }

    public void setProductTitle(String productTitle) {
        this.productTitle = productTitle;
    }

    public String getProductImg() {
        return productImg;
    }

    public void setProductImg(String productImg) {
        this.productImg = productImg;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    /**
     * 商品单价 * 购买数量
     * @return
     */
    public BigDecimal getTotalAmount() {
        return this.amount.multiply(new BigDecimal(this.buyNum));
    }

    @Override
    public String toString() {
        return "CartItemVO{" +
                "productId=" + productId +
                ", buyNum=" + buyNum +
                ", productTitle='" + productTitle + '\'' +
                ", productImg='" + productImg + '\'' +
                ", amount=" + amount +
                ", totalAmount=" + totalAmount +
                '}';
    }
}
